/* $RCSFile: ADNDynContact.cs $
 * Apache license v2 2011 by Christian Surieux
 * $Source: ?/CRMWrapper3/DynEntities/ADNDynContact.cs $
 * $log$
 * Revision 19 2010/10/02 14:01:48  christian.surieux
 *   Corrected a bug in allmost everyADNDyn file for PrimaryFieldVualue
 * Revision 6 2010/08/06 19:56:32  christian.surieux
 *   Added Log to All cs files
 */

using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Globalization;

using CrmSdk;

namespace AddonNice.CRMWrapper
{
	public class ADNDynContact : ADNDynCustomer
	{
        protected class Ftor: DFactor
        {
            public Ftor() : base(CrmStr.contact)
            {}

            public override Type DynType
            { get { return typeof(ADNDynContact); } }

            public override string DynTypename
            {   get{ return CrmStr.contact;}}

            public override DynEntity Build()
            {   return new ADNDynContact();}

            public override DynEntity Build(CRMWrapperBase w, InternalDynamicEntity dEntity, PropertyDescriptorCollection wproperties)
            {   return new ADNDynContact(w, dEntity, wproperties, null);}

            public override DynEntity Build(CRMWrapperBase w, string PrimaryFieldValue)
            {   return new ADNDynContact(w);}

            public override DynEntity Build(CRMWrapperBase w,Guid PrimaryKeyValue)
            {   return new ADNDynContact(w,PrimaryKeyValue);}
        }

        static ADNDynContact(){new Ftor();} 

		/// <summary>
		/// Reserved for template methods: do not use directly
		/// </summary>
        public ADNDynContact(): base()
		{}

        public ADNDynContact(CRMWrapperBase w)
			: base(w,CrmStr.contact)
		{}

        public ADNDynContact(CRMWrapperBase w, string firstName,string lastName)
			: base(w,CrmStr.contact)
		{
			if ( !string.IsNullOrEmpty(firstName ) )
                firstname   =   firstName;
			if ( !string.IsNullOrEmpty(lastName ) )
    			lastname    =   lastName;
		}
		public ADNDynContact(CRMWrapperBase w, Guid CrmId)
			: base(w,CrmStr.contact, CrmId)
		{}

        public ADNDynContact(CRMWrapperBase w, InternalDynamicEntity e)
			: base(w,CrmStr.contact,e,null,null)
		{}

		public ADNDynContact(CRMWrapperBase w, InternalDynamicEntity e, PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(w,CrmStr.contact,e,prop,s)
		{}

        public ADNDynContact(ResetWrapperHandler fn, string firstName,string lastName)
			: base(fn,CrmStr.contact)
		{
			if ( !string.IsNullOrEmpty(firstName ) )
                firstname   =   firstName;
			if ( !string.IsNullOrEmpty(lastName ) )
    			lastname    =   lastName;
		}

		public ADNDynContact(ResetWrapperHandler fn, Guid CrmId)
			: base(fn,CrmStr.contact, CrmId)
		{}

        public ADNDynContact(ResetWrapperHandler fn, InternalDynamicEntity e)
			: base(fn,CrmStr.contact,e,null,null)
		{}

		public ADNDynContact(ResetWrapperHandler fn, InternalDynamicEntity e, PropertyDescriptorCollection prop,InternalColumnSet s)
			: base(fn,CrmStr.contact,e,prop,s)
		{}

        [CrmDynAttribute(CrmStr.contact)]
        public Guid contactid
		{
			get
			{
				return KeyPropertyValue(CrmStr.contactid);
			}
			set
			{
				AddKeyProperty(CrmStr.contactid, value);
			}
		}

        protected override void SetCrmIdProperty(Guid crmId)
        {
           if ( !dicProperty.ContainsKey(CrmStr.contactid) || KeyPropertyValue(CrmStr.contactid) != crmId )
                contactid   =   crmId;
        }

        public override Guid PrimaryKeyGuidValue
        {
           get
           {
                return contactid;
           }
           set
           {
               contactid    =   value;
           }
        }

        public override string PrimaryFieldName
        {
            get
            {
               return CrmStr.fullname;
            }
           set
           {}
        }

        /// <summary>
        /// Value contained in the PrimaryField for the DynEntity or empty if no PrimaryField
        /// </summary>
        public override string PrimaryFieldStringValue
        {
            get
            {
                return fullname;
            }
            set
            {
                fullname =   value;
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string firstname
		{
			get
			{
				return StringPropertyValue(CrmStr.firstname);
			}
			set
			{
				AddStringProperty(CrmStr.firstname, value);
			}
		}

        [CrmDynAttribute(CrmStr.contact)]
		public string lastname
		{
			get
			{
				return StringPropertyValue(CrmStr.lastname);
			}
			set
			{
				AddStringProperty(CrmStr.lastname, value);
			}
		}

        [CrmDynAttribute(CrmStr.contact)]
		public string nickname
		{
			get
			{
				return StringPropertyValue(CrmStr.nickname);
			}
			set
			{
				AddStringProperty(CrmStr.nickname, value);
			}

		}

        [CrmDynAttribute(CrmStr.contact)]
		public string salutation
		{
			get
			{
				return StringPropertyValue(CrmStr.salutation);
			}
			set
			{
				AddStringProperty(CrmStr.salutation, value);
			}

		}

        string _DefaultParentCustomerName   =   CrmStr.account;
		public string DefaultParentCustomerName
		{
			get
			{
				return _DefaultParentCustomerName;
			}
			set
			{
                switch (value)
                {
                    case CrmStr.account:
                    case CrmStr.contact:
                        _DefaultParentCustomerName  =   value;
                        break;
                }
			}
		}

        /// <summary>
        /// Beware SET defaults to account, to change it set DefaultParentCustomerName property before calling set
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public Guid parentcustomerid
		{
			get
			{
                if ( dicProperty.ContainsKey(CrmStr.parentcustomerid) )
				    return CustomerPropertyValue(CrmStr.parentcustomerid);
                return Guid.Empty;
			}
			set
			{
				AddCustomerProperty(CrmStr.parentcustomerid,DefaultParentCustomerName, value);
			}
		}

        public string parentcustomerName
        {
            get
            {
                if ( dicProperty.ContainsKey(CrmStr.parentcustomerid) )
                    return CustomerPropertyName(CrmStr.parentcustomerid);
                return string.Empty;
            }
        }
        
        /// <summary>
        /// The entity : account or contact
        /// </summary>
        public string parentCustomerType
        {
            get 
            {
                if ( dicProperty.ContainsKey(CrmStr.parentcustomerid) )
                    return CustomerPropertyType(CrmStr.parentcustomerid);
                return string.Empty;
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public Guid preferredequipmentid
		{
			get
			{
				return LookupPropertyValue(CrmStr.preferredequipmentid );
			}
			set
			{
				AddLookupProperty(CrmStr.preferredequipmentid,CrmStr.equipment,value);
			}
		}

        public string preferredequipmentidName
		{
			get
			{
                if ( dicProperty.ContainsKey(CrmStr.preferredequipmentid) )
    				return LookupPropertyName(CrmStr.preferredequipmentid );
                return string.Empty;
			}
		}

        [CrmDynAttribute(CrmStr.contact)]
        public Guid preferredserviceid 
		{
			get
			{
				return LookupPropertyValue(CrmStr.preferredserviceid );
			}
			set
			{
				AddLookupProperty(CrmStr.preferredserviceid,CrmStr.service,value);
			}
		}

        public string preferredserviceidName
		{
			get
			{
                if ( dicProperty.ContainsKey(CrmStr.preferredserviceid) )
    				return LookupPropertyName(CrmStr.preferredserviceid );
                return string.Empty;
			}
		}

        [CrmDynAttribute(CrmStr.contact)]
        public Guid preferredsystemuserid 
		{
			get
			{
				return LookupPropertyValue(CrmStr.preferredsystemuserid );
			}
			set
			{
				AddLookupProperty(CrmStr.preferredsystemuserid,CrmStr.systemuser,value);
			}
		}

        public string preferredsystemuseridName
		{
			get
			{
                if ( dicProperty.ContainsKey(CrmStr.preferredsystemuserid) )
    				return LookupPropertyName(CrmStr.preferredsystemuserid );
                return string.Empty;
			}
		}

        [CrmDynAttribute(CrmStr.contact)]
        public Guid defaultpricelevelid
		{
			get
			{
                if ( ContainsKey(CrmStr.defaultpricelevelid) )
				    return LookupPropertyValue(CrmStr.defaultpricelevelid );
                return Guid.Empty;
			}
			set
			{
				AddLookupProperty(CrmStr.defaultpricelevelid,CrmStr.pricelevel,value);
			}
		}

        public string defaultpricelevelName
		{
			get
			{
                if ( dicProperty.ContainsKey(CrmStr.defaultpricelevelid) )
    				return LookupPropertyName(CrmStr.defaultpricelevelid );
                return string.Empty;
			}
		}

        [CrmDynAttribute(CrmStr.contact)]
        public string employeeid
        {
            get
            {
                return StringPropertyValue(CrmStr.employeeid);
            }
            set
            {
                AddStringProperty(CrmStr.employeeid,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string mobilephone
        {
            get
            {
                return StringPropertyValue(CrmStr.mobilephone);
            }
            set
            {
                AddStringProperty(CrmStr.mobilephone,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string jobtitle
        {
            get
            {
                return StringPropertyValue(CrmStr.jobtitle);
            }
            set
            {
                AddStringProperty(CrmStr.jobtitle,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string birthdate
        {
            get
            {
                return StringPropertyValue(CrmStr.birthdate);
            }
            set
            {
                AddStringProperty(CrmStr.birthdate,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string suffix
        {
            get
            {
                return StringPropertyValue(CrmStr.suffix);
            }
            set
            {
                AddStringProperty(CrmStr.suffix,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string spousesname
        {
            get
            {
                return StringPropertyValue(CrmStr.spousesname);
            }
            set
            {
                AddStringProperty(CrmStr.spousesname,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string assistantname
        {
            get
            {
                return StringPropertyValue(CrmStr.assistantname);
            }
            set
            {
                AddStringProperty(CrmStr.assistantname,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string assistantphone
        {
            get
            {
                return StringPropertyValue(CrmStr.assistantphone);
            }
            set
            {
                AddStringProperty(CrmStr.assistantphone,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string department
        {
            get
            {
                return StringPropertyValue(CrmStr.department);
            }
            set
            {
                AddStringProperty(CrmStr.department,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string externaluseridentifier
        {
            get
            {
                return StringPropertyValue(CrmStr.externaluseridentifier);
            }
            set
            {
                AddStringProperty(CrmStr.externaluseridentifier,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string governmentid
        {
            get
            {
                return StringPropertyValue(CrmStr.governmentid);
            }
            set
            {
                AddStringProperty(CrmStr.governmentid,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string websiteurl
        {
            get
            {
                return StringPropertyValue(CrmStr.websiteurl);
            }
            set
            {
                AddStringProperty(CrmStr.websiteurl,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public string ftpsiteurl
        {
            get
            {
                return StringPropertyValue(CrmStr.ftpsiteurl);
            }
            set
            {
                AddStringProperty(CrmStr.ftpsiteurl,value);
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public string pager
        {
            get
            {
                return StringPropertyValue(CrmStr.pager);
            }
            set
            {
                AddStringProperty(CrmStr.pager,value);
            }
        }

        /// <summary>
        /// Default value
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int territorycode
		{
			get
			{
				return PicklistPropertyIntValue(CrmStr.territorycode);
			}
			set
			{
				AddPicklistProperty(CrmStr.territorycode,value);
			}
		}

        public string territorycodeLabel
        {
            get
            {
                if ( ContainsKey(CrmStr.territorycode) )
                    return PicklistPropertyLabelValue(CrmStr.territorycode);
                return string.Empty;
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public bool isbackofficecustomer
        {
            get 
            {
                return BooleanPropertyValue(CrmStr.isbackofficecustomer);
            }
            set
            {
                AddBooleanProperty(CrmStr.isbackofficecustomer,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public int numberofchildren
        {
            get
            {
                if ( ContainsKey(CrmStr.numberofchildren) )
                    return NumberPropertyValue(CrmStr.numberofchildren);
                return 0;
            }
            set
            {
                AddNumberProperty(CrmStr.numberofchildren,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public decimal annualincome
        {
            get
            {
                if ( ContainsKey(CrmStr.annualincome) )
                    return MoneyPropertyValue(CrmStr.annualincome);
                return 0m;
            }
            set
            {
                AddMoneyProperty(CrmStr.annualincome,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public decimal annualincome_base
        {
            get
            {
                if ( ContainsKey(CrmStr.annualincome_base) )
                    return MoneyPropertyValue(CrmStr.annualincome_base);
                return 0m;
            }
            set
            {
                AddMoneyProperty(CrmStr.annualincome_base,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public decimal creditlimit
        {
            get
            {
                if ( ContainsKey(CrmStr.creditlimit) )
                    return MoneyPropertyValue(CrmStr.creditlimit);
                return 0m;
            }
            set
            {
                AddMoneyProperty(CrmStr.creditlimit,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public decimal creditlimit_base
        {
            get
            {
                if ( ContainsKey(CrmStr.creditlimit_base) )
                    return MoneyPropertyValue(CrmStr.creditlimit_base);
                return 0m;
            }
            set
            {
                AddMoneyProperty(CrmStr.creditlimit_base,value);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public bool creditonhold
        {
            get 
            {
                return BooleanPropertyValue(CrmStr.creditonhold);
            }
            set
            {
                AddBooleanProperty(CrmStr.creditonhold,value);
            }
        }
        
        /// <summary>
        /// Net 30
        /// 2% 10, Net 30
        /// Net 45
        /// Net 60
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int paymenttermscode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.paymenttermscode);
            }
            set
            {
                AddPicklistProperty(CrmStr.paymenttermscode,value);
            }
        }
         
        public string paymenttermscodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.paymenttermscode);
            }
        }
        
        /// <summary>
        /// No values on install
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int shippingmethodcode
		{
			get
			{
				return PicklistPropertyIntValue(CrmStr.shippingmethodcode);
			}
			set
			{
				AddPicklistProperty(CrmStr.shippingmethodcode,value);
			}
		}

        public string shippingmethodcodeLabel
        {
            get
            {
                if ( ContainsKey(CrmStr.shippingmethodcode) )
                    return PicklistPropertyLabelValue(CrmStr.shippingmethodcode);
                return string.Empty;
            }
        }

        /// <summary>
        /// Sunday
        /// Monday
        /// Tuesday
        /// Wednesday
        /// Thursday
        /// Friday
        /// Saturday
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int preferredappointmentdaycode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.preferredappointmentdaycode);
            }
            set
            {
                AddPicklistProperty(CrmStr.preferredappointmentdaycode,value);
            }
        }
         
        public string preferredappointmentdaycodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.preferredappointmentdaycode);
            }
        }

        /// <summary>
        /// Morning
        /// Afternoon
        /// Evening
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int preferredappointmenttimecode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.preferredappointmenttimecode);
            }
            set
            {
                AddPicklistProperty(CrmStr.preferredappointmenttimecode,value);
            }
        }
         
        public string preferredappointmenttimecodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.preferredappointmenttimecode);
            }
        }

        /// <summary>
        /// Any ->default
        /// E-mail
        /// Phone
        /// Fax
        /// Mail
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int preferredcontactmethodcode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.preferredcontactmethodcode);
            }
            set
            {
                AddPicklistProperty(CrmStr.preferredcontactmethodcode,value);
            }
        }
         
        public string preferredcontactmethodcodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.preferredcontactmethodcode);
            }
        }

        /// <summary>
        /// Male
        /// Female
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int gendercode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.gendercode);
            }
            set
            {
                AddPicklistProperty(CrmStr.gendercode,value);
            }
        }
         
        public string gendercodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.gendercode);
            }
        }

        /// <summary>
        /// Single
        /// Married
        /// Divorced
        /// Widowed
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int familystatuscode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.familystatuscode);
            }
            set
            {
                AddPicklistProperty(CrmStr.familystatuscode,value);
            }
        }
         
        public string familystatuscodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.familystatuscode);
            }
        }
        
        /// <summary>
        /// No values on install
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int haschildrencode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.haschildrencode);
            }
            set
            {
                AddPicklistProperty(CrmStr.haschildrencode,value);
            }
        }
         
        public string haschildrencodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.haschildrencode);
            }
        }

        /// <summary>
        /// No values on install
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int educationcode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.educationcode);
            }
            set
            {
                AddPicklistProperty(CrmStr.educationcode,value);
            }
        }
         
        public string educationcodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.educationcode);
            }
        }

        /// <summary>
        /// Preferred Customer
        /// Standard
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public int accountrolecode  
        {
            get
            {
                return PicklistPropertyIntValue(CrmStr.accountrolecode);
            }
            set
            {
                AddPicklistProperty(CrmStr.accountrolecode,value);
            }
        }
         
        public string accountrolecodeLabel
        {
            get
            {
                return PicklistPropertyLabelValue(CrmStr.accountrolecode);
            }
        }

        [CrmDynAttribute(CrmStr.contact)]
        public int customertypecode
		{
			get
			{
				return PicklistPropertyIntValue(CrmStr.customertypecode);
			}
			set
			{
				AddPicklistProperty(CrmStr.customertypecode,value);
			}
		}

        public string customertypecodeLabel
        {
            get
            {
                if ( ContainsKey(CrmStr.customertypecode) )
                    return PicklistPropertyLabelValue(CrmStr.customertypecode);
                return string.Empty;
            }
        }
        
        [CrmDynAttribute(CrmStr.contact)]
        public int customersizecode
		{
			get
			{
				return PicklistPropertyIntValue(CrmStr.customersizecode);
			}
			set
			{
				AddPicklistProperty(CrmStr.customersizecode,value);
			}
		}

        public string customersizecodeLabel
        {
            get
            {
                if ( ContainsKey(CrmStr.customersizecode) )
                    return PicklistPropertyLabelValue(CrmStr.customersizecode);
                return string.Empty;
            }
        }

        /// <summary>
        /// virtual because on 'detail' records it is only a uniqueidentifier property
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public Guid owningbusinessunit
        {
            get
            {
                return LookupPropertyValue(CrmStr.owningbusinessunit);
            }
            set
            {
                AddLookupProperty(CrmStr.owningbusinessunit,CrmStr.businessunit,value);
            }
        }
        /// <summary>
        /// Owner for this object
        /// </summary>
        [CrmDynAttribute(CrmStr.contact)]
        public override Guid ownerid
        {
            get
            {
                if ( ContainsKey(CrmStr.ownerid) )
                    return OwnerPropertyValue(CrmStr.ownerid);
                return Guid.Empty;
            }
            set
            {
                AddOwnerProperty(CrmStr.ownerid,CrmStr.systemuser,value);
            }
        }


        public enum ContactState : int
        {
            Active      =   0,// Specifies that the contact is active. statuscode Active 1 
            Inactive    =   1 // Specifies that the contact is inactive. statuscode Inactive 2 
        }

        public void SetState(ContactState st,int status,bool isAdmin)
        {
            wrapper.Util.SetContactState(this,st,status,isAdmin);
        }

        #region Utilities 

        public ADNDynCustomer RetrieveCustomer()
        {
            if (CRMDynTraceSwitch.Sw.TraceVerbose)
                Trace.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]ADNDynContact RetrieveCustomer BEG Entity: {0}, customerid: {1}",
                    parentCustomerType,parentcustomerid),CRMDynTraceSwitch.Sw.Info);
            
            switch(parentCustomerType)
            {
                case CrmStr.account:
                    ADNDynAccount waccount  =   new ADNDynAccount(wrapper,parentcustomerid);
                    waccount.adminRetrieve();
                    if ( waccount != null )
                    {
                        if ( CRMDynTraceSwitch.Sw.TraceVerbose )
                            Trace.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]ADNDynContact RetrieveCustomer found account: {0}-{1}",
                                waccount.name,waccount.accountid),CRMDynTraceSwitch.Sw.Info);
                        return waccount;
                    }
                    break;
                case CrmStr.contact:
                    ADNDynContact wcontact   =   new ADNDynContact(wrapper,parentcustomerid);
                    wcontact.adminRetrieve();
                    if ( wcontact != null )
                    {
                        if ( CRMDynTraceSwitch.Sw.TraceVerbose )
                            Trace.WriteLine( string.Format(CultureInfo.InvariantCulture,"[V]ADNDynContact RetrieveCustomer found contact: {0}-{1}",
                                wcontact.lastname,wcontact.contactid),CRMDynTraceSwitch.Sw.Info);
                        return wcontact;
                    }
                    break;
            }
            return null;
        }

        public static ADNDynContact FindContactByName(CRMWrapperBase Wrapper,string fullName,bool CreateIfNotFound,ref bool created)
        {
            bool created2       =   created;
            ADNDynContact dynC  =   Wrapper.Util.FindContactByName(fullName,CreateIfNotFound,ref created2);
            created             =   created2;
            return dynC;

        }

        public static ADNDynContact FindContactByName(CRMWrapperBase Wrapper,string firstName,string lastName,bool CreateIfNotFound,ref bool created)
        {
            bool created2       =   created;
            ADNDynContact dynC  =   Wrapper.Util.FindContactByName(firstName,lastName,CreateIfNotFound,ref created2);
            created             =   created2;
            return dynC;
        }

        #endregion Utilities 

    }
}
